import PopComponent from './Pop.vue'

const Pop = {}

Pop.install = (Vue) => {
  // 创建一个实例，并且将元素挂载到div上，然后挂载到body上面
  const PopConstructor = Vue.extend(PopComponent)
  const instance = new PopConstructor()
  instance.$mount(document.createElement('div'))
  document.body.appendChild(instance.$el)

  // 4. 添加实例方法

  Vue.prototype.$pop = function (type, msg) {
    instance.type = type
    instance.msg = msg
    instance.isShow = true
  }
}

export default Pop
